use axum::{response::IntoResponse, routing::get, Router};
use reqwest::{self};

pub fn add_vpn_router() -> Router {
    Router::new().route("/vpn", get(get_vpn))
}

async fn get_vpn() -> impl IntoResponse {
    const URL: &str = "https://ghproxy.com/https://raw.githubusercontent.com/freefq/free/master/v2";
    let client = reqwest::ClientBuilder::new()
        .danger_accept_invalid_certs(true)
        .build()
        .unwrap();

    let body = client.get(URL).send().await.unwrap().text().await.unwrap();
    return body;
}
